package com.sino.dataworks.job;

import cn.hutool.core.date.DateUtil;
import com.sino.dataworks.cache.PhoneCache;
import com.sino.dataworks.entity.DwDutyRoster;
import com.sino.dataworks.util.DataworksUtil;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;

import java.util.Date;

@Slf4j
public class NotifyTask implements Job {


    @Override
    public void execute(JobExecutionContext jobExecutionContext)  {
        String day=DateUtil.format(DateUtil.offsetDay(new Date(),1),"yyyyMMdd");
        if (PhoneCache.phoneCache.containsKey(day)) {
            DwDutyRoster dutyRoster = PhoneCache.phoneCache.get(day);
            String phone=dutyRoster.getFirstPhone();
            DataworksUtil.phoneWarning("下周值班请保持手机畅通",phone,phone,phone);
        }

    }

}
